<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition lang="en" xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core" template="./main.xhtml">
	<f:metadata>
		<f:event listener="#{periodController.initialize}" type="preRenderView"/>
		<f:viewParam name="periodType" value="#{periodConversation.periodType}"></f:viewParam>
	</f:metadata>
	<ui:define name="content">
	<br/>
	<h:form>
		<p:commandButton icon="ui-icon-triangle-1-w" action="#{periodController.prior}" update="@form"/>
		<p:commandButton icon="ui-icon-bullet" action="#{periodController.current}" update="@form" disabled="#{periodController.currentDisabled}"/>
		<p:commandButton icon="ui-icon-triangle-1-e" action="#{periodController.next}" update="@form" disabled="#{periodController.nextDisabled}"/>
		<p:tabView activeIndex="#{sessionBean.loginStaffIndex}">
			<c:forEach items="#{sessionBean.staffList}" var="staff">
				<p:tab title="#{staff.formalName}">
					<p:dataTable value="#{periodController.getDailyList(staff)}" var="record" styleClass="noWrap">
						<p:column headerText="日付">
							<h:outputText value="#{record.daily.date}" styleClass="red" rendered="#{record.holiday}">
								<f:convertDateTime pattern="MM月dd日（E）" locale="ja_JP"/>
							</h:outputText>
							<h:outputText value="#{record.daily.date}" rendered="#{record.holiday eq false}">
								<f:convertDateTime pattern="MM月dd日（E）" locale="ja_JP"/>
							</h:outputText>
						</p:column>
						<p:column headerText="作業時間">
							<h:outputText value="#{record.workTime}"/>
						</p:column>
						<p:column headerText="内容" styleClass="pre left">
							<h:outputText value="#{record.daily.content}"/>
						</p:column>
						<p:column>
							<p:commandButton action="#{periodController.editDaily}" rendered="#{periodController.isTodayBefore(record.daily.date) and record.editPermission}" value="#{record.daily.entityId eq null ? '入力':'編集'}" styleClass="button_small">
								<f:setPropertyActionListener target="#{periodConversation.selectDaily}" value="#{record.daily}"/>
							</p:commandButton>
						</p:column>
					</p:dataTable>
				</p:tab>
			</c:forEach>
		</p:tabView>
	</h:form>
	</ui:define>
</ui:composition>
